package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 根据菜品id查询对应的套餐
     * @param dishIds
     * @return
     */
    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);

    /**
     * 插入setmealDish
     * @param setmealDish
     */
    void insert(SetmealDish setmealDish);

    /**
     * 根据dishId来删除数据
     * @param id
     */
    @Delete("delete from sky_take_out.setmeal_dish where dish_id = #{id};")
    void deleteBySetmealId(Long id);

    /**
     * 通过setmealId查找数据
     * @param id
     * @return
     */
    @Select("select * from sky_take_out.setmeal_dish where setmeal_id = #{id};")
    List<SetmealDish> queryById(Long id);
}
